Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Server Feat: connection2w3cwebsocket #431

Open
wants to merge 8 commits into
base: master
Choose a base branch
from

Conversation

formula1
Copy link

Your websockets do some good stuff but, for consistencies sake and perhaps some browserify action, I wanted to use the W3CWebsocket interface with a server connection. I had forked your project a while ago but I suppose I wasn't able to figure out how to get it done. Well, I got it done.

Notes

  • connection2w3cwebsocket is a very simple function
  • W3CWebSocket now inherits W3CWebSocketWrapper and much of the guts have been moved over there
  • Right now, W3CWebSocket listens to the close event to cleanup it's client.
    • this covers client failure, close while connecting and normal closing
    • If ever a consumer decided to remove all event listeners for this, the client will not get cleaned up.
    • This is also the case for some of the connection close events. Hopefully, nobody does something silly
  • I didn't know what to name W3CWebSocketWrapper
  • I added some tests, effectively just copied the W3CWebSocket tests.
    • the server based W3CWebSocket doesn't emit an open event.
    • I considered doing a Promise.resolve() then opening it but I'm not sure if its relevant
    • I'm definitely open to to implementing one if that is important it really should be easy

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant